package com.engr.lyx.blog.biz.service.impl;

import com.engr.lyx.blog.biz.repository.common.AuthorRepository;
import com.engr.lyx.blog.biz.service.PublicService;
import com.engr.lyx.blog.client.entity.Author;
import com.engr.lyx.common.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: blog
 * @description:
 * @author: lyx
 * @create: 2019-06-29
 **/
@Service
public class PublicServiceImpl implements PublicService {

    @Autowired
    private AuthorRepository authorRepository;

    @Override
    public Author selectByUserId(Long userId) {

        return authorRepository.findByUserId(userId).orElseThrow(() -> new ServiceException("couldn't found user"));
    }

}
